import request from '@/utils/request'

// 打卡记录列表
export function listRecord(query) {
  return request({
    url: '/org/clockIn/record/list',
    method: 'get',
    params: query
  })
}

// 下属打卡记录列表
export function listSubRecord(query) {
  return request({
    url: '/org/clockIn/record/sub/list',
    method: 'get',
    params: query
  })
}

// 打卡记录详细
export function getRecord(id) {
  return request({
    url: `/org/clockIn/record/${id}`,
    method: 'get'
  })
}

// 新增打卡记录
export function addRecord(data) {
  return request({
    url: '/system/record',
    method: 'post',
    data: data
  })
}

// 修改打卡记录
export function updateRecord(data) {
  return request({
    url: '/system/record',
    method: 'put',
    data: data
  })
}

// 删除打卡记录
export function delRecord(id) {
  return request({
    url: `/org/clockIn/record/${id}`,
    method: 'delete'
  })
}

// 打卡距离查询
export function getClockInAllowRange() {
  return request({
    url: `/system/user/getClockInAllowRange`,
    method: 'get'
  })
}

// 修改打卡距离
export function updateClockInAllowRange(data) {
  return request({
    url: '/system/user/updateClockInAllowRange',
    method: 'put',
    data: data
  })
}

// 所有项目签到范围
export function getProjectSignRangeList(params) {
  return request({
    url: '/manager/project/signRangeList',
    method: 'get',
    params
  })
}

// 修改打卡的范围
export function updateProjectSignRange(data) {
  return request({
    url: '/manager/project',
    method: 'put',
    data
  })
}